import { request } from '@umijs/max';



//通用规则
export async function creatCustomer(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/customer/save';
    return request(url, {
        method: 'POST',
        data: params,
    });
}

export async function getCustomerById(id: string): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/customer/get/${id}`;
    return request(url, {
        method: 'GET'
    });
}

export async function getCustomerInfo(): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/customer/get/self`;
    return request(url, {
        method: 'GET'
    });
}



export async function updateCustomer(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/customer/update';
    return request(url, {
        method: 'POST',
        data: params,
    });
}


export async function updateCustomerStatus(id: string,status:number): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/customer/update/${id}/${status}`;
    return request(url, {
        method: 'put',
    });
}

export async function pageListCustomer(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/customer/page_list';
    return request(url, {
        method: 'POST',
        data: params,
    });
}

export async function pageListCustomerAndCost(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/customer/page';
    return request(url, {
        method: 'POST',
        data: params,
    });
}


export async function resetCustomerPwdById(id: string): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/customer/reset-password/${id}`;
    return request(url, {
        method: 'PUT'
    });
}


export async function listCustomer(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/customer/list';
    return request(url, {
        method: 'POST',
        data: params,
    });
}

export async function get_customer_list():Promise<BackendResponse<any>>  {
    return request(`/admin-api/system/customer/selectList`, {
        method: 'GET',
    });
}